<template>
  <div class="el-img">
    <el-carousel v-if="src.length > 1">
      <el-carousel-item v-for="item in src" :key="item">
        <img style="width: 480px; height: 320px;" :src="'/store/sop/img/' + item">
      </el-carousel-item>
    </el-carousel>
    <div v-else style="text-align: center;">
      <img :src="'/store/sop/img/' + src[0]" style="margin: auto" >
    </div>
    <div class="el-carousel__title">{{ title }}</div>
  </div>
</template>

<script>
export default {
  name: 'ElImg',
  props: {
    src: {
      type: Array,
      default: ['1.jpg']
    },
    title: {
      type: String,
      default: '图X-X'
    }
  }
}
</script>

<style scoped>
.el-img {
  page-break-inside: avoid;
  margin: 16px 0;
}

/**跑马灯 图片展示**/
.el-carousel--horizontal {
  height: 320px;
  width: 480px;
  margin: auto;
  margin-top: 8px !important;
  margin-bottom: 8px !important;
}

.el-carousel__container {
  height: 320px !important;
  text-align: center;
}

.el-carousel__item {
  height: 320px;
  width: 480px;
}

.el-carousel__title {
  text-align: center;
  font-size: 13px;
  color: #5e6d82;
  margin-bottom: 10px !important;
}

.el-carousel__item:nth-child(2n) {
  background-color: #99a9bf;
}

.el-carousel__item:nth-child(2n+1) {
  background-color: #d3dce6;
}
</style>